package gof_003_行为型_Behavioral.gof_004_策略_Strategy.gof_001_Normal;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

    //生成学生列表
    public static List<Student> generateStudentList() {
        List<Student> studentList = Stream.of(
                new Student("赵18",18),
                new Student("钱19",19),
                new Student("孙20",20),
                new Student("李21",21),
                new Student("周22",22),
                new Student("吴23",23),
                new Student("郑24",24),
                new Student("王25",25)
        ).collect(Collectors.toList());
        return studentList;
    }

    //展示学生列表
    public static void showStudentList(List<Student> studentList) {
        System.out.println("======= 学生列表 =======");
        int index = 0;
        for (Student student : studentList) {
            System.out.println(++index + ".  姓名:" + student.getName() + "\t年龄:" + student.getAge());
        }
    }


    public static void main(String[] args) {
        List<Student> studentList = generateStudentList();
        showStudentList(studentList);

        FilterStudent filterStudent = new FilterStudent();
        List<Student> filterList = filterStudent.filter(studentList);
        showStudentList(filterList);
    }
}
